#ifndef SERIALHANDLER_H
#define SERIALHANDLER_H

#include <QObject>
#include <termios.h>

class serialHandler : public QObject
{
    Q_OBJECT
public:
    explicit serialHandler(QObject *parent = 0);

signals:
    void serialBytes(QByteArray sbytes);
    void logMessage(QString message);
    void serialFailure();

public slots:
    bool openSerial();
    void closeSerial();
    void setPortName(QString newPortName);   //char *newPortName);
    void setBaud(long baud);

private:
    bool serialStream();
    struct termios tio;
    struct termios stdio;
    int tty_fd;
    QString portName;
    //fd_set rdset; //don't know what this does or if it is really needed

};

#endif // SERIALHANDLER_H
